package com.zzh.partnersys.sensitiveword.service;

import com.zzh.partnersys.entity.SensitiveWordDO;
import com.zzh.partnersys.mapper.SensitiveWordMapper;
import com.zzh.partnersys.sensitiveword.algorithm.IWordFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author ??????
 * @version 1.0
 */
@Component
public class MyWordFactory implements IWordFactory {

    @Autowired
    private SensitiveWordMapper sensitiveWordMapper;

    @Override
    public List<String> getWordList() {
        return sensitiveWordMapper.selectList(null)
                .stream()
                .map(SensitiveWordDO::getWord)
                .collect(Collectors.toList());
    }
}
